<template>
	<view class="top-container">
	</view>

	<!-- 店铺头部卡片 -->
	<view class="shop-header-card">
		<image class="shop-banner" src="/static/images/1.jpg" mode="widthFix"></image>
		<view class="shop-info">
			<text class="shop-name">车百事汽车生活馆</text>
			<view class="shop-rating">
				<image class="star" v-for="i in 4" :key="i" src="/static/images/五星.png" mode="widthFix"></image>
				<text class="score">4分</text>
				<text class="sales">销量: 556</text>
			</view>
			<text class="shop-time">营业时间: 周一至周五 早上8:00-晚上22:00</text>
			<view class="shop-location">
				<text>位置: 山阳区人民路与解放路交叉口</text>
				<image class="location-icon" src="/static/images/plane.png" mode="widthFix"></image>
			</view>
		</view>
	</view>

	<!-- 服务项目模块 -->
	<view class="service-item-card">
		<text class="section-title">服务项目</text>
		<uni-section>
			<view class="service-options">
				<uni-data-checkbox v-model="radio1" :localdata="service"></uni-data-checkbox>
			</view>
		</uni-section>
		<view class="service-price">
			<text class="price">¥35.9</text>
			<text class="original-price">¥60</text>
		</view>
		<text class="service-desc">这里是精洗服务的详细介绍，这里是精洗服务的详细介绍，这里是精洗服务的详细介绍</text>
	</view>

	<!-- 服务评价模块 -->
	<view class="comment-card">
		<text class="section-title">服务评价</text>
		<view class="comment-item" v-for="(item, index) in comments" :key="index">

			<view class="comment-info">
				<image class="comment-avatar" :src="item.avatar" mode="widthFix"></image>
				<view class="comment-right">
					<view class="comment-right-top">
						<view class="comment-name">{{ item.name }}</view>
						<view class="comment-date">{{ item.date }}</view>
					</view>

					<view class="comment-stars">
						<image class="star" v-for="i in item.score" :key="i" src="/static/images/五星.png"
							mode="widthFix">
						</image>
					</view>
					<text class="comment-content">{{ item.content }}</text>
				</view>

			</view>
		</view>
	</view>

	<!-- 底部操作栏 -->
	<view class="bottom-bar">
		<view class="contact-service" @click="toggle('bottom')">
			<image class="service-icon" src="/static/images/客服.png" mode="widthFix"></image>
			<text>联系客服</text>
		</view>
		<view class="order-btn" @click="gotoOrder()">现在下单</view>
	</view>
	<view>
		<!-- 普通弹窗 -->
		<uni-popup ref="popup" background-color="#fff" @change="change">
			<view class="popup-content" :class="{ 'popup-height': type === 'left' || type === 'right' }">
				<view class="text">15031324789</view>
				<view class="text">复制</view>
				<view class="text">取消拨号</view>
			</view>
		</uni-popup>
	</view>


</template>

<script>
	export default {
		data() {
			return {
				radio1: 0,
				service: [{
					text: '普通洗车',
					value: 0
				}, {
					text: '精洗',
					value: 1
				}, {
					text: '内饰清洗',
					value: 2
				}, {
					text: '其他清洗',
					value: 3
				}],
				// 模拟评价数据
				comments: [{
						name: "黄**",
						avatar: "/static/images/头3.jpg",
						date: "2022-12-31",
						score: 4,
						content: "洗的非常干净，几个小伙子很用心，态度也很好，强烈推荐来这家店洗车！！！"
					},
					{
						name: "黄**",
						avatar: "/static/images/头3.jpg",
						date: "2022-12-31",
						score: 4,
						content: "洗的非常干净，几个小伙子很用心，态度也很好，强烈推荐来这家店洗车！！！"
					},
					{
						name: "黄**",
						avatar: "/static/images/头3.jpg",
						date: "2022-12-31",
						score: 4,
						content: "洗的非常干净，几个小伙子很用心，态度也很好，强烈推荐来这家店洗车！！！"
					}
				]
			};
		},
		methods: {
			// open() {
			// 	// 通过组件定义的ref调用uni-popup方法 ,如果传入参数 ，type 属性将失效 ，仅支持 ['top','left','bottom','right','center']
			// 	this.$refs.popup.open('bottom')
			// },
			change(e) {
				console.log('当前模式：' + e.type + ',状态：' + e.show);
			},
			toggle(type) {
				this.type = type
				// open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
				this.$refs.popup.open(type)
			},
			gotoOrder() {

				uni.navigateTo({
					url: `/professional-car-wash/pages/confirm-order/confirm-order?serviceValue=${this.radio1}`
				})
			},
			// 返回上一页
			goBack() {
				uni.navigateBack();
			}
		}
	};
</script>

<style scoped>
	.top-container {
		background-color: #2176F3;
		height: 350rpx;
	}

	.popup-content {

		align-items: center;
		text-align: center;
		padding: 15px;
		height: 50px;
		background-color: #fff;

	}

	.popup-height {

		width: 200px;
	}

	.text {
		font-size: 12px;
		color: #333;
		line-height: 80rpx;
		border-bottom: 1rpx solid #F3F3F3;
	}

	/* 店铺头部卡片 */
	.shop-header-card {
		background-color: #fff;
		border-radius: 20rpx;
		margin: 20rpx;
		overflow: hidden;
		margin-top: -350rpx;

	}

	.shop-banner {
		width: 97%;
		height: 97%;
		padding: 10rpx;
		border-radius: 55rpx;
	}

	.shop-info {
		padding: 20rpx;
	}

	.shop-name {
		font-size: 32rpx;
		font-weight: bold;
		margin-bottom: 10rpx;
		display: block;
	}

	.shop-rating {
		display: flex;
		align-items: center;
		margin-bottom: 15rpx;
	}

	.star {
		width: 28rpx;
		height: 28rpx;
		margin-right: 6rpx;
	}

	.score {
		margin-right: 20rpx;
		font-size: 24rpx;
	}

	.sales {
		font-size: 24rpx;
		color: #999;
	}

	.shop-time {
		font-size: 24rpx;
		margin-bottom: 15rpx;
		display: block;
	}

	.shop-location {
		display: flex;
		align-items: center;
	}

	.location-icon {
		width: 24rpx;
		height: 24rpx;
		margin-left: 10rpx;
	}

	/* 服务项目卡片 */
	.service-item-card {
		background-color: #fff;
		border-radius: 20rpx;
		margin: 0 20rpx 20rpx;
		padding: 20rpx;
	}

	.section-title {
		font-size: 30rpx;
		font-weight: bold;
		margin-bottom: 20rpx;
		display: block;
	}

	.service-options {

		margin-top: -50rpx;
		margin-bottom: 20rpx;
	}

	.service-option {
		margin-right: 30rpx;
		margin-bottom: 15rpx;
		font-size: 26rpx;
	}

	.service-price {
		margin-bottom: 15rpx;
	}

	.price {
		font-size: 32rpx;
		color: #f5442c;
		font-weight: bold;
	}

	.original-price {
		font-size: 24rpx;
		color: #999;
		text-decoration: line-through;
		margin-left: 10rpx;
	}

	.service-desc {
		font-size: 24rpx;
		color: #666;
		line-height: 40rpx;
	}

	/* 评价卡片 */
	.comment-card {
		background-color: #fff;
		border-radius: 20rpx;
		margin: 0 20rpx 120rpx;
		padding: 20rpx;

	}

	.comment-item {
		display: flex;
		margin-bottom: 30rpx;
	}

	.comment-avatar {
		width: 100rpx;
		height: 100rpx;
		border-radius: 50%;
	}

	.comment-right {
		margin-left: 20rpx;
	}

	.comment-right-top {
		display: flex;
		justify-content: space-between;
	}

	.comment-info {
		display: flex;

	}

	.comment-name {
		font-size: 28rpx;
		font-weight: bold;
		margin-right: 20rpx;
	}

	.comment-date {
		font-size: 22rpx;
		color: #999;
	}

	.comment-stars {
		display: flex;
		margin: 10rpx 0;
	}

	.comment-content {
		font-size: 24rpx;
		color: #666;
		line-height: 36rpx;
	}

	/* 底部操作栏 */
	.bottom-bar {
		display: flex;
		align-items: center;
		justify-content: space-between;
		background-color: #fff;
		padding: 20rpx 30rpx;
		border-top: 1px solid #eee;

		position: fixed;
		/* 固定在底部 */
		bottom: 0;
		left: 0;
		right: 0;
	}

	.contact-service {
		display: flex;
		align-items: center;
	}

	.service-icon {
		width: 40rpx;
		height: 40rpx;
		margin-right: 10rpx;
	}

	.order-btn {
		background-color: #2176F3;
		color: #fff;
		width: 200rpx;
		height: 80rpx;
		line-height: 80rpx;
		border-radius: 40rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 28rpx;
	}
</style>